package com.hzhc.controller.sysmanage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzhc.common.BaseController;
import com.hzhc.entity.SysLog;
import com.hzhc.enumBean.ResultUtilCodeEnum;
import com.hzhc.service.SysLogService;
import com.hzhc.utils.ResultUtil;
import com.hzhc.vo.SysLogVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author 功不唐捐
 * @since 2024-04-07
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin")
public class SysLogController extends BaseController {

    private final SysLogService sysLogService;

    @RequestMapping("/getDataTablelogslist")
    public ResultUtil<List<SysLog>> getDatagridUserList(@RequestBody SysLogVo vo) {
        Page<SysLog> page = new Page<>(vo.getPageIndex(), vo.getPageSize());
        List<SysLog> logsList = sysLogService.findLogsList(page, vo);
        return ResultUtil.build(logsList,page.getTotal(), page.getPages(), ResultUtilCodeEnum.SUCCESS);
    }
}
